package wang.wincent.springboot.mybatisplus.controller;


import com.baomidou.mybatisplus.plugins.Page;

import wang.wincent.springboot.mybatisplus.entity.SysUser;
import wang.wincent.springboot.mybatisplus.service.SysUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class SysUserController {
	
	@Autowired
    private SysUserService sysUserService;

    @RequestMapping("/save")
    public boolean saveUser(SysUser user) {
        return sysUserService.insert(user);
    }

    @RequestMapping("/get/{id}")
    public SysUser getUser(@PathVariable Integer id) {
        return sysUserService.selectById(id);
    }

    @RequestMapping("/del/{id}")
    public boolean delUser(@PathVariable Integer id) {
        return sysUserService.deleteById(id);
    }

    @RequestMapping("/getPage")
    public Page<SysUser> getUserPage(Page<SysUser> userPage) {
        return sysUserService.selectPage(userPage);
    }

}
